@extends('layouts.mobile_main')

@section('title', '登录')

@section('resources')
    @parent
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <link rel="stylesheet" href="{{ env('CSS_DOMAIN') }}/css/public.css?v={{env('CSS_VERSION')}}">
    <script src="{{ env('JS_DOMAIN') }}/js/adaptation.js?v={{env('JS_VERSION')}}"></script>
    <style>
		#entry_phonenum{width: 6.6rem;height: 1.2rem;border-bottom: 1px solid #BDBDBD;margin-top: 2.6rem;margin-left: 0.6rem;background: url({{env('IMAGE_DOMAIN')}}images/login_phone.png) 0.2rem 0.2rem no-repeat;background-size: 0.8rem;padding-left: 3rem;}
    </style>
@endsection

@section('content')
<header class="entry oh">
    
	<a class="fl oh" href="javascript:history.go(-1);">
	    <img class="fl" src="{{env('IMAGE_DOMAIN')}}images/back_g.png?v={{env('IMAGE_VERSION')}}" alt="">
	</a>
	
</header>
<section class="entry_center">
	<div class="entry_headpic pr">
		<img src="{{env('IMAGE_DOMAIN')}}images/login_logo.png?v={{env('IMAGE_VERSION')}}" alt="">
	</div>
    <!--
	<form method="GET" action="/mobile/login">
		<input class="fz_48" id="entry_phonenum" type="text" name="mobile" placeholder="请输入手机号" autocomplete="off" maxlength="15" onpropertychange="check();" oninput="check();">
		<input type="submit" value="下一步" id="entry_sub">
	</form>
    -->
	{!! Form::open(array('action' => 'MobileWeb\IndexController@loginCode', 'method'=>'get','class'=>'m-t')) !!}
        <div class="form-group">
          {!! Form::text('mobile', null, ['class' => 'form-control fz_48', 'id'=>'entry_phonenum','placeholder'=>'请输入手机号', 'autocomplete'=>"off" ]) !!}
        </div>
        <div class="form-group">
          {!! Form::submit('下一步', ['class' => 'btn btn-primary form-control', 'id'=>'entry_sub']) !!}
        </div>
    {!! Form::close() !!}

</section>
@endsection

@section('scriptResources')
    @parent
    <script>
	window.onresize=function(){
		pagesp();
	}
	if($("#entry_phonenum").val()!=0){
		$("#entry_sub").css("background-color","#9a54c6");
	}else{
		$("#entry_sub").css("background-color","#ccc");
	}
	function check(){
		var phone=$("#entry_phonenum").val();
		if(phone!=0){
			$("#entry_sub").css("background-color","#9a54c6");
			$("#entry_sub").click(function(){
				phone=$("#entry_phonenum").val();
				var myreg=/^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
				if(phone==""){
					$(".prompt").html("手机号码不能为空");return;
				}else if(phone.length!=11){
					$(".prompt").html("请输入有效的手机号码1");return;
				}else if(!myreg.test(phone)){
					$(".prompt").html("请输入有效的手机号码2");return;
				}
			})
		}else{
			$("#entry_sub").css("background-color","#ccc");
			$("#entry_sub").removeAttr("disable");
		}
	}
	//firefox下检测状态改变只能用oninput,且需要用addEventListener来注册事件。   
    if(/msie/i.test(navigator.userAgent))    //ie浏览器   
        {document.getElementById('entry_phonenum').onpropertychange=check   
    } else{//非ie浏览器，比如Firefox   
        document.getElementById('entry_phonenum').addEventListener("input",check,false);   
    }   
	$(function(){
		var paysu_outer_h=$(window).height();
		$(".paysu_outer").css({"min-height":paysu_outer_h});
		// $("#entry_sub").click(function(){
		// 	var phone=$("#entry_phonenum").val();
		// 	var myreg=/^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
		// 	if(phone==""){
		// 		$(".prompt").html("手机号码不能为空");return;
		// 	}else if(phone.length!=11){
		// 		$(".prompt").html("请输入有效的手机号码");return;
		// 	}else if(!myreg.test(phone)){
		// 		$(".prompt").html("请输入有效的手机号码");return;
		// 	}
		// })
	})
</script>
@endsection